package com.qyer.lxp.common.framework.contants;

import com.qyer.lxp.model.availability.normal.Available;
import com.qyer.lxp.model.location.normal.Locations;
import com.qyer.lxp.model.price.normal.AvailableDate;
import com.qyer.lxp.model.price.normal.Prices;
import com.qyer.lxp.model.price.normal.PricesCollection;
import com.qyer.lxp.model.product.normal.ProductCodeInfos;
import com.qyer.lxp.model.product.normal.ProductInfo;
import com.qyer.lxp.model.product.normal.ProductPickInfos;
import com.qyer.lxp.model.product.normal.SaleItemInfoList;

/**
 * Created by jiangping on 16/6/2.
 */
public enum ErrorLogEnum {

    METHOD_NAME_GETLOCATIONINFO("getLocationInfo",Locations.class),
    METHOD_NAME_GETUPDATEPRODUCTINFO("getUpdateProductInfo",ProductCodeInfos.class),
    METHOD_NAME_GETPRICEBYDAY("getPriceByDay",Prices.class),
    METHOD_NAME_GETPRICEBYPERIOD("getPriceByPeriod",PricesCollection.class),
    METHOD_NAME_GETAVAILABLEDATES("getAvailableDates",AvailableDate.class),
    METHOD_NAME_GETPICKORDROP("getPickOrDrop",ProductPickInfos.class),
    METHOD_NAME_GETSALEITEMINFO("getSaleItemInfo",SaleItemInfoList.class),
    METHOD_NAME_GETAVAILABLITY("getAvailablity",Available.class),
    METHOD_NAME_GETPRODUCTDETAIL("getProductDetail",ProductInfo.class);

    private String methodName;
    private Class className;

    public String getMethodName() {
        return methodName;
    }

    public Class getClassName() {
        return className;
    }

    ErrorLogEnum(String methodName, Class className){
        this.methodName = methodName;
        this.className = className;
    }

    /**
     * 返回类
     * @param methodName
     * @return
     */
    public static Class getErrorLog(String methodName){
        if(null == methodName || "".equals(methodName.trim())){
            return null;
        }
        for(ErrorLogEnum errorLog : ErrorLogEnum.values()){
            if(errorLog.getMethodName().equals(methodName)){
                return errorLog.getClassName();
            }
        }
        return null;
    }
}
